package Test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;

public class ByteTest {
    public static void main(String[] args) throws UnsupportedEncodingException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream() ;
        String str=" '11111" ;
        ByteArrayInputStream bais = new ByteArrayInputStream(str.getBytes("UTF-16"));
        int ch=0;
        while((ch = bais.read( )) != -1){
            baos.write( ch );
        }
        System.out.println("UTF-8结果:" + baos.toString( ) );
                System.out.println("UTF-16结果:" + baos.toString( "UTF-16" ) );
    }

}

